package practise.alogrithm.hundredInterviewQuestions;

import practise.alogrithm.hundredInterviewQuestions.Utils.LinkedListBuilder;

import java.awt.*;

/**
 * Created by richard on 6/3/14.
 */
public class PutAllEvenInFrount {
    public static  int[] operation(int[] arrays){
        int end=arrays.length-1;
        for(int i=0; i<end;){
            if(arrays[i]%2!=0){
                LinkedListBuilder.swap(arrays,i,end--);
            }
            if(arrays[i]%2==0){
                i++;
            }
        }
        return arrays;
    }

    public static void main(String[] args){
        System.out.println("Result:"+operation(new int[]{1,3,2,4,5,6,7}));
    }


}
